package com.dushan.boot.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

/**
 * @Author：朗朗乾坤
 * @Package：com.dushan.boot.config
 * @Project：DuShanHui
 * @name：DemoPropertites
 * @Date：2024/1/22 19:57
 * @Filename：DemoPropertites
 */
@RefreshScope
@Data
@Configuration
@ConfigurationProperties(prefix = "demo")
public class DemoPropertites {

    private String test;

    public void testP(){
        System.out.println("testP");
    }

    public Map testRemoveHashMapElement(){
        Map map = new HashMap<String,String>(16);
        map.put("1","aaa");
        map.put("2","bbb");
        map.put("3","ccc");
        map.put("4","ddd");
        Iterator<String> iterator = map.keySet().iterator();
        while (iterator.hasNext()){
            String next = iterator.next();
            if("1".equals(next)){
                iterator.remove();
            }
        }
        return map;
    }
}
